#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2023/1/1 20:04
# @Author  : Xudong Geng
# @File    : mail.py
# @Software: PyCharm

import smtplib
from email.message import EmailMessage

# Define Variables
# user = 'gengxd@foxmail.com'
# password = 'whzeuvyeapmnbjej'
# smtpsrv = "smtp.qq.com"
# smtpserver = smtplib.SMTP(smtpsrv,587)
# mailbodyfile = '/app/release.txt'

user = 'no-reply@figure-eight.com'
password = 'T_h>9pFj%}z=UP2mfR3LRu/3qK^2K%>('
smtpsrv = "smtp.gmail.com"
smtpserver = smtplib.SMTP(smtpsrv,465)
mailbodyfile = '/app/release.txt'

# Open plain text file for mail body
with open(mailbodyfile) as fp:
    # Create a text/plain message
    msg = EmailMessage()
    msg.set_content(fp.read())

msg['Subject'] = 'ADAP Deployment Notice Mail'
msg['From'] = 'no-reply@figure-eight.com'
msg['To'] = 'xgeng@appen.com, gengxd@foxmail.com'


# Send Email Message
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.login(user, password)
smtpserver.send_message(msg)
smtpserver.close()